package com.ctgu1;

public class NextData {
	public static String classify(int year, int month, int day) {
		  String nextd="";
		  int dayfab=28;
		  int dayusual=30;
		  if((year%4==0 && year%100!=0) || (year%400==0))
		   dayfab=29;
		  if(month==1||month==3||month==5||month==7||month==8||month==10)
		   dayusual=31;
		  
		  if(month==12)
		  {
		   if(day==31)
		    nextd=add(year+1, 1, 1);
		   else if(day<dayusual)
		    nextd=add(year, month, day+1);
		   else if(day>dayusual)
		    nextd="error day data";
		  }
		  else if(month==2)
		  {
		    if(day<dayfab)
		     {nextd=add(year, month, day+1);}
		    if(day==dayfab)
		     {nextd=add(year, month+1, 1);}
		    if(day>dayfab)
		     {nextd="error day data";}
		  }
		  else if(month>12)
		  {nextd="error month data";}
		  else
		  {if(day==dayusual)
		   nextd=add(year, month+1, 1);
		  else if(day<dayusual)
		   nextd=add(year, month, day+1);
		  else if(day>dayusual)
		   nextd="error day data";
		  }return nextd;
		  
	
	
	}	  
	static String add(int year,int month,int day ){
		   String time=Integer.toString(year)+"."+Integer.toString(month)+"."+Integer.toString(day);
		   return time;
		  }
}
